﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
//using UILibrary.Olap.UITestApplication;

namespace AnalysisApp.Silverlight
{
    public partial class MainPage : UserControl
    {
        public string OLAPConnectionString { get; set; }

        public MainPage(string strOLAPConnectionString)
        {
            OLAPConnectionString = strOLAPConnectionString;
            InitializeComponent();
            Loaded += Page_Loaded;
            Ranet.AgOlap.Commands.CommandHelper.Initialize(connectionId => OLAPConnectionString);
            OldConnectionString = OLAPConnectionString;

        }
        public string OldConnectionString;

        /// <summary>
        /// Выставляем строку подключения по умолчанию или зачитываем сохраненную
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void Page_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(OLAPConnectionString))
                OLAPConnectionString = @"Provider=MSOLAP.4;DATA SOURCE=DPP-813\SQL2008R2;CATALOG=ADVENTURE WORKS DW;";
        }
    }
}
